from faker import Faker
from models.models import GoodsType
from flask import Flask
from models.models import db

app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "mysql+pymysql://root:123456@localhost:3306/e-web"
db.init_app(app)

fake = Faker(locale='zh_CN')

with app.app_context():
    for i in range(100):
        name = " ".join(fake.words(3))
        _type = GoodsType(name=name)
        db.session.add(_type)
    db.session.commit()

